/**
 * MockJS模拟数据
 */

import Mock from 'mockjs'
import {devConfig} from '@/http/config'
//import * as login from '@/mock/modules/login'
import * as frame from '@/mock/modules/frame'

const mockXHR = function () {
	const isOpen = true
	//createMockData(login, isOpen)
	createMockData(frame, isOpen)
}

function createMockData(module, isOpen) {
	if (isOpen) {
		for (let mod in module) {
			((res) => {
				let url = devConfig.baseURL
				url = url + res.url
				console.log(url)
				Mock.mock(url, res.type, Mock.mock(res.data))
			})(module[mod]())
		}
	}
}

export default mockXHR
